﻿namespace Gaiaware.Web.SkinSandbox.Usercontrols
{
    using System;
    using Utilities;

    public partial class ThemeSelector : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void ddlThemes_SelectedIndexChanged(object sender, EventArgs e)
        {
            //set to session and set stylesheetheme
            WebUtility.StyleSheetTheme = ddlThemes.SelectedValue;

            //redirect to current page to reach Pre_Init in SamplePage.cs
            Response.Redirect(Request.Url.PathAndQuery);
        }

        protected void ddlThemes_Init(object sender, EventArgs e)
        {
            ddlThemes.DataSource = WebUtility.GetThemes();
            ddlThemes.DataBind();

            if (Page.StyleSheetTheme != null)
                ddlThemes.Items.FindByValue(Page.StyleSheetTheme.ToLower()).Selected = true;
        }
    }
}